<?php
class Model_DbTable_Answers extends HackerU_Db_Table
{
	public function getNumOfCorrectAnswers(array $answerIds)
	{
		$numOfCorrectAnswers = 0;
		if($answerIds){
			$in = implode(',', $answerIds);
			$sql = "select count(id) as numOfCorrectAnswers from $this->name where id in($in) and isCorrect = 1";
			$result = $this->fetchByQuery($sql);
			if($result){
				$numOfCorrectAnswers = (int)$result[0]->numOfCorrectAnswers;
			}
		}
		return $numOfCorrectAnswers;
;	}
}